package demo6;

import java.lang.reflect.Constructor;

public class Demo3 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("demo6.Student");
//        Object o1 = cls.newInstance();
//        System.out.println(o1);
        Constructor c = cls.getDeclaredConstructor();
        c.setAccessible(true);
        Object o2 = c.newInstance();
        System.out.println(o2);
        Object o3 = c.newInstance();
        System.out.println(o3);

        Person p1 = new Person();
        System.out.println(p1);
        Person p2 = new Person();
        System.out.println(p2);
    }
}
